

package org.example.infrastructure.repository.orm.redis.config;

import org.redisson.api.RBloomFilter;
import org.redisson.api.RedissonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 布隆过滤器配置
 */
@Configuration
public class UrlShortenerCacheBloomFilterConfig {

    @Bean
    public RBloomFilter<String> urlShortenerCacheBloomFilter(RedissonClient redissonClient){
        RBloomFilter<String> userRegistryCacheBloomFilter = redissonClient.getBloomFilter("urlShortenerCacheBloomFilter");
        userRegistryCacheBloomFilter.tryInit(100000000L, 0.001);
        return userRegistryCacheBloomFilter;
    }
}
